package com.sgb.goods.view.activity.details.order;

import android.text.TextUtils;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.sgb.goods.BR;
import com.sgb.goods.R;
import com.sgb.goods.databinding.GoodsActivityReceiptGoodsDetailsBinding;
import com.sgb.goods.utils.Constants;
import com.sgb.goods.utils.TimeUtils;
import com.sgb.goods.utils.base.BaseActivity;
import com.sgb.goods.viewmodel.ReceiptGoodsDetailsModel;
import com.swgk.core.recyclerview.decoration.RecyclerCustomDecoration;

/**
 * 商品订单收货详情
 * 参数:
 *      receiveId：车牌号
 * @author cyj
 */
@Route(path = Constants.ARouter.AR_RECEIPT_GOODS_DEL)
public class ReceiptGoodsDetailsActivity extends BaseActivity<GoodsActivityReceiptGoodsDetailsBinding, ReceiptGoodsDetailsModel> {

    @Override
    protected int getLayoutResId() {
        return R.layout.goods_activity_receipt_goods_details;
    }

    @Override
    protected void initViewModel() {
        mViewModel = createViewModel(ReceiptGoodsDetailsModel.class, BR.viewModel);
    }

    @Override
    protected void init() {
        mDataBinding.head.title.setText("收货详情");

        mDataBinding.rlvView.addItemDecoration(new RecyclerCustomDecoration(0, 0, 0,
                getResources().getDimension(R.dimen.dp1), getResources().getColor(R.color.goods_color_FFF5F5F5)));

        mViewModel.getReceiveDetails(getIntent().getStringExtra("receiveId"));
    }

    @Override
    protected void initObserve() {
//        mViewModel.requireData.observe(this, goodsDetailsEntity -> {
//            if (!TextUtils.isEmpty(goodsDetailsEntity.createdTimestamp)) {
//                mDataBinding.tvPayTime.setText(TimeUtils.formatCustomTimeString(Long.parseLong(goodsDetailsEntity.createdTimestamp), "yyyy-MM-dd HH:mm:ss"));
//            }
//            if (!TextUtils.isEmpty(goodsDetailsEntity.receivingTimestamp)) {
//                mDataBinding.tvReceiveTime.setText(TimeUtils.formatCustomTimeString(Long.parseLong(goodsDetailsEntity.receivingTimestamp), "yyyy-MM-dd HH:mm:ss"));
//            }
//        });
    }

    @Override
    protected void initListener() {
        mDataBinding.head.ivBack.setOnClickListener(v -> finish());
    }
}